package maptest

import "fmt"

func Test() {
	//定义map
	var a map[int]string
	b := make(map[int]string, 1)
	b[111] = "张三"
	b[222] = "22三"
	b[333] = "233三"
	_, ok := b[222]
	fmt.Println(ok)
	c := map[string]string{
		"姓名1":  "张三",
		"姓名12": "李四",
	}
	//删除map
	delete(c, "姓名12")
	//map添加元素
	c["姓名13"] = "王五"
	//查询map是否有值
	_, ok = c["姓名16"]
	fmt.Println(a, b, c, ok)
	//遍历
	for k, v := range c {
		fmt.Println(k, v)
	}

}
